package com.wxmit.ot.gen.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.wxmit.ot.base.core.OtBaseEntity;
import com.wxmit.ot.base.validate.AddGroup;
import com.wxmit.ot.base.validate.UpdateGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.List;
import java.util.Map;

/**
 * 代码生成 模版组 实体对象
 *
 * @author huangxiong
 * @version V1.0
 * @date 2023/2/22 10:39
 */
@EqualsAndHashCode(callSuper = true)
@TableName(value="ot_gen_group")
@Data
public class GenGroup extends OtBaseEntity {

    @TableId(type = IdType.AUTO)
    @NotNull(message = "修改操作，id不能为空！",groups = {UpdateGroup.class})
    @Null(message = "新增操作，不可携带id！",groups = {AddGroup.class})
    private Long id;

    @NotNull(message="模版组名字不能为空！")
    private String name;

    private String remark;

    @TableField(exist = false)
    @NotEmpty(message = "模版组内元素不能为空")
    private List<GenGroupItem> items;

    @TableField(typeHandler = JacksonTypeHandler.class )
    private Map<String,String> extra;
}
